package com.zscat.mallplus.utils;


import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 微信小程序码工具
 */
public class WXQRCodeUtil {

    private static Logger log = LoggerFactory.getLogger(WXQRCodeUtil.class);

    /**
     * 根据设备id生成设备小程序码
     *
     * @param deviceId 设备id
     * @return 小程序码
     */
    public static byte[] getDeviceQRCodeById(Long deviceId, String token) {
        String tmpurl = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + token;
        JSONObject json = new JSONObject();
        json.put("scene", deviceId);
        json.put("page", "pages/meallist/selectMealByQRcode");
        byte[] result = WX_HttpsUtil.post(tmpurl, json.toString());
        return result;
    }

}
